<template>
  <div class="risk-compliance c-shadow">
    <h4 class="detail-title">合规风险总数：<span>{{(total + total3 + total1 + total2 + total4 + total5 + total6 + total7) || 0}}</span></h4>
    <div class="judgment">
      <h4 class="detail-base-title">裁判文书</h4>
      <j-no-data v-if="writData.length === 0" :mode="'b'" msg="b"></j-no-data>
      <div class="table-wrap" v-else>
        <table>
          <thead>
            <tr>
              <th v-for="title in writ" :key="title">{{title}}</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="item in writData" :key="item.writ">
              <td>{{item.publishtime | dateFormat}}</td>
              <td>{{item.type}}</td>
              <td>{{item.casecode}}</td>
              <td>{{item.courtname}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="block paging-wrap fr">
        <el-pagination v-if="total>5"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="pageNum"
          :page-size="pageSize"
          layout="prev, pager, next, jumper"
          :total="total">
        </el-pagination>
      </div>
    </div>
    <div class="executor clearFix">
        <h4 class="detail-base-title">法院被执行人</h4>
        <j-no-data v-if="courtData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table>
            <thead>
              <tr>
                <th v-for="title in executor" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="item in courtData" :key="item.writ">
                <td>{{item.executeDate | dateFormat}}</td>
                <td>{{item.executerName}}</td>
                <td>{{item.caseNo}}</td>
                <td>{{item.court}}</td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="block paging-wrap fr">
          <el-pagination v-if="total3>5"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange3"
            :current-page.sync="pageNum3"
            :page-size="pageSize3"
            layout="prev, pager, next, jumper"
            :total="total3">
          </el-pagination>
        </div>
    </div>
    <div class="sx-record clearFix">
        <h4 class="detail-base-title">被执行人失信记录</h4>
        <j-no-data v-if="sxData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table>
            <thead>
              <tr>
                <th v-for="title in executor" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="item in sxData" :key="item.writ">
                <td>{{item.publishDate | dateFormat}}</td>
                <td>{{item.executerName}}</td>
                <td>{{item.caseNo}}</td>
                <td>{{item.count}}</td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="paging-wrap feature_wrap fr" v-if="total>5">
          <el-pagination v-if="total1>5"
          @size-change="handleSizeChange"
            @current-change="handleCurrentChange1"
            :current-page.sync="pageNum1"
            :page-size.sync="pageSize1"
            layout="prev, pager, next, jumper"
            :total.sync="total1">
          </el-pagination>
        </div>
    </div>
    <div class="sw-punish clearFix">
        <h4 class="detail-base-title">税务处罚</h4>
        <j-no-data v-if="swData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table>
            <thead>
              <tr>
                <th v-for="title in tax" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="item in swData" :key="item.writ">
                <td>{{item.punishStartTime | dateFormat}}</td>
                <td>{{item.punishEndTime | dateFormat}}</td>
                <td>{{item.taxCode}}</td>
                <td>{{item.name}}</td>
                <td>{{item.caseCode}}</td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="paging-wrap fr">
          <el-pagination v-if="total2>5"
          @size-change="handleSizeChange"
            @current-change="handleCurrentChange2"
            :current-page.sync="pageNum2"
            :page-size.sync="pageSize2"
            layout="prev, pager, next, jumper"
            :total.sync="total2">
          </el-pagination>
        </div>
    </div>
    <div class="hb-punish clearFix">
        <h4 class="detail-base-title">环保处罚</h4>
        <j-no-data v-if="hbData.length === 0" :mode="'b'" msg="b"></j-no-data>
        <div class="table-wrap" v-else>
          <table>
            <thead>
              <tr>
                <th v-for="title in environmental" :key="title">{{title}}</th>
              </tr>
            </thead>
            <tbody>
              <tr v-for="item in hbData" :key="item.writ">
                <td>{{item.punishDate | dateFormat}}</td>
                <td>{{item.punishType}}</td>
                <td>{{item.caseCode}}</td>
                <td>{{item.punishOrg}}</td>
              </tr>
            </tbody>
          </table>
        </div>
        <div class="paging-wrap fr">
          <el-pagination v-if="total4>5"
          @size-change="handleSizeChange"
            @current-change="handleCurrentChange4"
            :current-page.sync="pageNum4"
            :page-size.sync="pageSize4"
            layout="prev, pager, next, jumper"
            :total.sync="total4">
          </el-pagination>
        </div>
    </div>
    <div class="yjh-punish clearFix">
      <h4 class="detail-base-title">银监会处罚</h4>
      <j-no-data v-if="comData.length === 0" :mode="'b'" msg="b"></j-no-data>
      <div class="table-wrap" v-else>
        <table>
          <thead>
            <tr>
              <th v-for="title in commission" :key="title">{{title}}</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="item in comData" :key="item.comData">
              <td>{{item.punishmentDate | dateFormat}}</td>
              <td>{{item.bookNumber}}</td>
              <td>{{item.reason}}</td>
              <td>{{item.punishOrg}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="paging-wrap fr">
        <el-pagination v-if="total5>5"
        @size-change="handleSizeChange"
          @current-change="handleCurrentChange5"
          :current-page.sync="pageNum5"
          :page-size.sync="pageSize5"
          layout="prev, pager, next, jumper"
          :total.sync="total5">
        </el-pagination>
      </div>
    </div>
    <div class="zjh-punish clearFix">
      <h4 class="detail-base-title">证监会处罚</h4>
      <j-no-data v-if="zhengjhData.length === 0" :mode="'b'" msg="b"></j-no-data>
      <div class="table-wrap" v-else>
        <table>
          <thead>
            <tr>
              <th v-for="title in zhengjh" :key="title">{{title}}</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="item in zhengjhData" :key="item.title">
              <td>{{item.pubTime | dateFormat}}</td>
              <td>{{item.bookid}}</td>
              <td>{{item.dept}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="paging-wrap fr">
        <el-pagination v-if="total6>5"
        @size-change="handleSizeChange"
          @current-change="handleCurrentChange6"
          :current-page.sync="pageNum6"
          :page-size.sync="pageSize6"
          layout="prev, pager, next, jumper"
          :total.sync="total6">
        </el-pagination>
      </div>
    </div>
    <div class="bjh-punish clearFix">
      <h4 class="detail-base-title">保监会处罚</h4>
      <j-no-data v-if="baojhData.length === 0" :mode="'b'" msg="b"></j-no-data>
      <div class="table-wrap" v-else>
        <table>
          <thead>
            <tr>
              <th v-for="title in baojh" :key="title">{{title}}</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="item in baojhData" :key="item.baojhData">
              <td>{{item.pubTime | dateFormat}}</td>
              <td>{{item.content}}</td>
              <td>{{item.bookName}}</td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="paging-wrap fr">
        <el-pagination v-if="total7>5"
        @size-change="handleSizeChange"
          @current-change="handleCurrentChange7"
          :current-page.sync="pageNum7"
          :page-size.sync="pageSize7"
          layout="prev, pager, next, jumper"
          :total.sync="total7">
        </el-pagination>
      </div>
    </div>
  </div>
</template>
<script>
import { jNoData } from '../../components'
import { sysSetting as api } from '../../api'
export default {
  data() {
    return {
      writ: ['裁判日期', '案件类型', '案号', '法院名称'],
      writData: [],
      executor: ['立案时间', '被执行人姓名/名称', '案号', '执行法院'],
      courtData: [],
      sxData: [
        // {
        //   time: '2018-02-23',
        //   name: '金易融(湖北)网络科技有限公司',
        //   reference: '渝环监罚〔2017〕154号',
        //   court: '成都市青羊区人民法院'
        // },
        // {
        //   time: '2018-02-23',
        //   name: '金易融(湖北)网络科技有限公司',
        //   reference: '渝环监罚〔2017〕154号',
        //   court: '成都市青羊区人民法院'
        // },
        // {
        //   time: '2018-02-23',
        //   name: '金易融(湖北)网络科技有限公司',
        //   reference: '渝环监罚〔2017〕154号',
        //   court: '成都市青羊区人民法院'
        // },
        // {
        //   time: '2018-02-23',
        //   name: '金易融(湖北)网络科技有限公司',
        //   reference: '渝环监罚〔2017〕154号',
        //   court: '成都市青羊区人民法院'
        // },
        // {
        //   time: '2018-02-23',
        //   name: '金易融(湖北)网络科技有限公司',
        //   reference: '渝环监罚〔2017〕154号',
        //   court: '成都市青羊区人民法院'
        // }
      ],
      tax: [
        '处罚生效日期',
        '处罚截止日期',
        '税务登记号',
        '纳税人姓名',
        '行政处罚决定书文号'
      ],
      swData: [],
      environmental: [
        '处罚日期',
        '处罚类型',
        '行政处罚决定书文号',
        '作出处罚决定的机关'
      ],
      hbData: [],
      commission: [
        '处罚决定的日期',
        '行政处罚决定书文号',
        '主要违法违规事实',
        '决定机关'
      ],
      comData: [],
      zhengjh: ['发文日期', '行政处罚决定书文号', '发文机构'],
      zhengjhData: [],
      baojh: ['发布时间', '事件名称', '行政处罚决定书文号'],
      baojhData: [],
      params: {},
      pageNum: 1,
      pageSize: 5,
      total: 0,
      pageNum1: 1,
      pageSize1: 5,
      total1: 0,
      pageNum2: 1,
      pageSize2: 5,
      total2: 0,
      pageNum3: 1,
      pageSize3: 5,
      total3: 0,
      pageNum4: 1,
      pageSize4: 5,
      total4: 0,
      pageNum5: 1,
      pageSize5: 5,
      total5: 0,
      pageNum6: 1,
      pageSize6: 5,
      total6: 0,
      pageNum7: 1,
      pageSize7: 5,
      total7: 0,
      number: '',
      entId: ''
    }
  },
  mounted() {
    this.params.entName = this.$route.query.entname
    // this.params.entId = this.$route.query.entid
    this.getRefereeList()
    this.getExecutorInfoList()
    this.getBreakFaithList()
    this.getSwList()
    this.getNumber()
    this.getHbList()
    this.getYjhList()
    this.getZjhList()
    this.getBjhList()
  },
  methods: {
    // 获取合规风险总数
    getNumber() {
      api.getRiskCount({ entId: this.$route.query.entid }).then(rtn => {
        this.number = rtn.data
      })
    },
    // 获取裁判文书列表
    getRefereeList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum,
        pageSize: _this.pageSize
      }
      api
        .getfindRefereeList({ ..._this.params, ...params })
        .then(rtn => {
          _this.writData = rtn.data.list
          _this.total = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleSizeChange() {
      // 当pagesize改变的时候出发该函数
    },
    handleCurrentChange(index) {
      this.pageNum = index
      this.getRefereeList()
    },
    // 获取法院被执行人
    getExecutorInfoList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum3,
        pageSize: _this.pageSize3
      }
      api
        .getExecutorInfoList({ ..._this.params, ...params })
        .then(rtn => {
          _this.courtData = rtn.data.list
          _this.total3 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleCurrentChange3(index) {
      this.pageNum3 = index
      this.getExecutorInfoList()
    },
    // 获取被执行人失信记录
    getBreakFaithList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum1,
        pageSize: _this.pageSize1
      }
      api
        .getBreakFaithList({ ..._this.params, ...params })
        .then(rtn => {
          _this.sxData = rtn.data.list
          _this.total1 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleCurrentChange1(index) {
      this.pageNum1 = index
      this.getBreakFaithList()
    },
    // 获取税务处罚
    getSwList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum4,
        pageSize: _this.pageSize4
      }
      api
        .getSwList({ ..._this.params, ...params })
        .then(rtn => {
          _this.swData = rtn.data.list
          _this.total2 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleCurrentChange2(index) {
      this.pageNum2 = index
      this.getBreakFaithList()
    },
    // 获取环保处罚
    getHbList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum4,
        pageSize: _this.pageSize4
      }
      api
        .getEnvironProtectList({ ..._this.params, ...params })
        .then(rtn => {
          _this.hbData = rtn.data.list
          _this.total4 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleCurrentChange4(index) {
      this.pageNum4 = index
      this.getHbList()
    },
    // 获取银监会处罚
    getYjhList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum5,
        pageSize: _this.pageSize5
      }
      api
        .getCbrcPunishList({ ..._this.params, ...params })
        .then(rtn => {
          _this.comData = rtn.data.list
          _this.total5 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleCurrentChange5(index) {
      this.pageNum5 = index
      this.getYjhList()
    },
    // 获取证监会处罚
    getZjhList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum6,
        pageSize: _this.pageSize6
      }
      api
        .getCsrcPunishList({ ..._this.params, ...params })
        .then(rtn => {
          _this.zhengjhData = rtn.data.list
          _this.total6 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleCurrentChange6(index) {
      this.pageNum6 = index
      this.getZjhList()
    },
    getBjhList() {
      let _this = this
      let params = {
        pageNum: _this.pageNum7,
        pageSize: _this.pageSize7
      }
      api
        .getCircPunishList({ ..._this.params, ...params })
        .then(rtn => {
          _this.baojhData = rtn.data.list
          _this.total7 = rtn.data.total
        })
        .catch(err => {
          _this.pageState = err
        })
    },
    handleCurrentChange7(index) {
      this.pageNum7 = index
      this.getBjhList()
    }
  },
  components: {
    jNoData
  }
}
</script>
<style lang="scss" scoped>
.risk-compliance {
  padding: 28px 40px;
  font-size: 14px;
  .detail-base-title {
    line-height: 30px;
    font-size: 16px;
    font-weight: bold;
    padding: 30px 0 0 12px;
    position: relative;
    background-image: linear-gradient(0deg,#1891ef,#1891ef);
    background-size: 3px 16px;
    background-position: 0 37px;
    background-repeat: no-repeat;
    border-bottom: 1px solid #eee;
  }
  .table-wrap {
    padding: 30px 20px;
    table {
      border-collapse: collapse;
      width: 100%;
      text-align: center;
      td,
      th {
        border: 1px solid #e2e2e2;
        line-height: 40px;
      }
      th {
        line-height: 38px;
        color: #999;
        background: #f2f1f1;
      }
    }
  }
}
</style>



// WEBPACK FOOTER //
// src/view/relationDetail/riskCompliance.vue